--# -path=.:prelude

resource MorphoChi = open Prelude in {

  -- the lexicon construction API
  param
    Order = Dir | Inv ;

    oper
      mkN : overload {
        mkN : (wine : Str) -> (bottle : Str) -> Noun ;
      } ;

      mkA : Str -> Bool -> Adjective ;

      mkV : overload {
        mkV : (kiss : Str) -> Verb ;
      } ;

      mkV2 : overload {
        mkV2 : (love : Verb) -> Verb2 ;
        mkV2 : (talk : Verb) -> (about : Str) -> Verb2 ;
      } ;

  -- grammar-internal definitions

    param
      Number = Sg | Pl ;

    oper
      Conjunction : Type = {s,s2,a,a2,n,n2,v,v2 : Str} ;
      Noun : Type = {s, cl : Str} ;
      Adjective : Type = {s : Str ; cop : Bool} ;
      Adverb : Type = {s : Order => Str ; lock_Adv : {} } ;
      Verb : Type = {s : Str} ;
      Verb2 : Type = Verb ** {c : Str} ;

      mkN = overload {
        mkN : (_,_ : Str) -> Noun = mkNoun ;
      } ;

      --Adjectives are stative or verb-like; first ones act as predicatives with copula, second ones without.
      mkA : Str -> Bool -> Adjective = \adj,b ->
        {s = adj ; cop = b} ;

      mkV = overload {
        mkV : (kiss : Str) -> Verb = \s -> mkVerb s ;
      } ;

      mkV2 = overload {
        mkV2 : (love : Verb) -> Verb2 = \love -> love ** {c = []} ;
        mkV2 : (talk : Verb) -> (about : Str) -> Verb2 = 
          \talk,about -> talk ** {c = about} ;
      } ;

      --The noun and the classificator
      mkNoun : Str -> Str -> Noun = \n,cl ->
        {s = n ; cl = cl} ;

      --The verb
      mkVerb : Str -> Verb = \x ->
        {s = x} ;

  }

